<template>
  <div class="flex flex-col h-full">
    <SearchContainer @search="getData" @reset="() => formRef.resetFields()">
      <a-form ref="formRef" class="form-style-flex" :model="formState" :label-col="{ style: { width: '70px' } }">
        <a-form-item name="xmlb" label="项目类别" class="w-72 ml-2">
          <a-select v-model:value="formState.xmlb" placeholder="请选择" mode="multiple">
            <a-select-option value="2">西药</a-select-option>
            <a-select-option value="4">中成药</a-select-option>
            <a-select-option value="5">中药</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item name="pyjm" class="w-1/4 ml-3">
          <a-input v-model:value="formState.pyjm" placeholder="药品编号/药品名称/助记码" />
        </a-form-item>
      </a-form>
    </SearchContainer>
    <a-card class="mt-2 flex-1">
      <!-- <div class="mb-3">
        <a-button @click="onExport">导出</a-button>
      </div> -->
      <BaseTable :loading="loading" column-code="000053" :data-source="tableData" bordered fill :pagination="pagination">
        <template #bodyCell="{ column, index, record }">
          <template v-if="column.dataIndex === 'xh'">
            <div>{{ index + 1 }}</div>
          </template>
          <template v-if="column.dataIndex === 'mc'">
            <MedicineInfo :value="{ mc: record.mc, gg: record.gg, cj: record.cj }" />
          </template>
        </template>
      </BaseTable>
    </a-card>
    <Edit v-model:open="editOpen" :row-data="rowData" @success="onSuceess" />
  </div>
</template>

<script setup>
// import { post } from '@/utils/request'
import { ref } from 'vue'
import SearchContainer from '@/components/SearchContainer'
import BaseTable from '@/components/BaseTable'
// import { message } from 'ant-design-vue'
// import downloadCSV from '@/utils/tools/downloadCSV'

const rowData = ref(null)
const editOpen = ref(false)
const formRef = ref(null)
const formState = ref({
  xmlb: [],
  pyjm: ''
})
const { loading, tableData, pagination, getData } = useTable({
  url: '/drugStorage/psiform/getlnventorvWarningList',
  immediate: true,
  params: formState.value
})
</script>
<style lang="less" scoped>
.ant-picker {
  width: 100%;
}
</style>
